package com.situ.water_BE.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.situ.water_BE.pojo.BeFlow;
import com.situ.water_BE.pojo.BeOrder;
import com.situ.water_BE.service.BeHistoryService;
import com.situ.water_BE.service.BeOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Angel
 * @since 2020-12-01
 */
@RestController
@RequestMapping("/be-history")
public class BeHistoryController { //流程历史记录
    @Autowired
    private BeHistoryService beHistoryService;
    @Autowired
    private BeOrderService beOrderService;

    @GetMapping("/queryAllBeHistory")
    public List<Map> queryAllBeHistory(String orderNo){
        BeOrder orderNo1 = beOrderService.queryIdBeOrder(new QueryWrapper<BeOrder>().
                eq("OrderNo", orderNo));
        BeFlow beFlow = beHistoryService.queryByBeFlow(orderNo1.getStepID());
        List<Map> maps = beHistoryService.queryAllBeHistory(orderNo);
        Map m=new HashMap<String,Object>();
        m.put("stepName","[当前]"+beFlow.getStepName());
        maps.add(m);
        return maps;
    }
}

